{% extends "./base.html" %}

{% block title %}
    {% if tag %}
        标签页：{{ tag.name }}
    {% elif category %}
        分类页：{{ category.name }}
    {% else %}
        首页
    {% endif %}

{% endblock %}

{% block main %}

    {% for post in post_list %}
        <div class="card post">
            <div class="card-body">
                <h5 class="card-title"><a href="{% url 'post_detail' post.id %}">{{ post.title }}</a></h5>
                <span class="card-link">作者：<a href="{% url 'post_list_author' post.owner.id %}">{{ post.owner.username }}</a> </span>
                <span class="card-link">分类：<a href="#">{{ post.category.name }}</a> </span>
                {% for tag in post.tag.all %}
                    <span class="card-link">标签：<a href="#">{{ post.tag.name }}</a> </span>
                {% endfor%}
                <p class="card-text">{{ post.desc }}<a href="#">完整内容</a></p>
            </div>
        </div>
    {% endfor %}

{% endblock %}